import { NewCarClueService } from '@/pc/new-car-clue/new-car-clue.service';
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { LockChannelDto } from '../wx-personal-channel/dto/lock-channel-dto';
import { WxNewCarClueService } from './wx-new-car-clue.service';

@ApiTags('小程序新车线索')
@Controller('wxnewcarclue')
export class WxNewCarClueController {
  constructor(private readonly wxNewCarClueService: WxNewCarClueService,
    private readonly newCarClueService: NewCarClueService) {}

  
  @Get('page')
  async findPage(@Query() query: any) {
    return await this.newCarClueService.findPage(query)
  }

  @Get()
  async findOne(@Query() query: { id: string }) {
    return await this.newCarClueService.findOne(query.id)
  } 

  @Get('new')
  async findNew() {
    return await this.wxNewCarClueService.findNew()
  }

  @Post('lock')
  async lockClue(@Body() dto: LockChannelDto) {
    return await this.wxNewCarClueService.lockClue(dto);
  }

  @Get('expire/:id')
  async checkClueLockExpire(@Param('id') id: string) {
    return await this.wxNewCarClueService.checkClueLockExpire(id)
  }

  @Get('checkOut/:id')
  async checkOuted(@Param('id') id: string) {
    return await this.wxNewCarClueService.checkOuted(id)
  }
}
